import request from '/@/utils/request'

export interface AdminForm {
  admin_id?: number
  username: string
  password?: string
  nickname: string
  avatar: string
  status: number
  role_ids: number[]
}

// 获取管理员列表
export function getAdminList(params: any) {
  return request({
    url: '/admin/admin/getList',
    method: 'get',
    params,
  })
}

// 创建管理员
export function createAdmin(data: AdminForm) {
  return request({
    url: '/admin/admin/doAdd',
    method: 'post',
    data,
  })
}

// 更新管理员
export function updateAdmin(data: AdminForm) {
  return request({
    url: '/admin/admin/doEdit',
    method: 'post',
    data,
  })
}

// 删除管理员
export function deleteAdmin(id: number) {
  return request({
    url: '/admin/admin/doDelete',
    method: 'post',
    data: { admin_id: id },
  })
} 